package com.itheima.wms.common.enums;

import java.util.EnumSet;
import java.util.HashMap;
import java.util.Map;

public enum IncreaseDecreaseIdSource {
    //盘点:PD、上架:SJ、拣货:JH
    PD("PD", "盘点"),
    SJ("SJ", "上架"),
    JH("JH", "拣货");


    IncreaseDecreaseIdSource(String code, String value) {

        this.code = code;
        this.value = value;
    }

    /**
     * 类型编码
     */
    private final String code;

    /**
     * 类型值
     */
    private final String value;


    public String getCode() {
        return code;
    }

    public String getValue() {
        return value;
    }


    /**
     * 循环变量
     */
    private static final Map<String, IncreaseDecreaseIdSource> LOOKUP = new HashMap<>();

    //静态初始化
    static {

        for (IncreaseDecreaseIdSource statusEnum : EnumSet.allOf(IncreaseDecreaseIdSource.class)) {

            LOOKUP.put(statusEnum.code, statusEnum);
        }
    }

    /**
     * 根据code获取枚举项
     *
     * @param code 值
     * @return 值
     */
    public static IncreaseDecreaseIdSource lookup(Integer code) {
        return LOOKUP.get(code);
    }
}
